<template>
  <div id="roleManagementUpdateRole">
    <Table :content="content" @submitRole="submitRole" />
  </div>
</template>

<script>

import {
  updateRole,getRole
} from '@/assets/request/api.js';

import Table from './table.vue';

export default {
  name: "roleManagementUpdateRole",
  data() {
    return {
      content: ""
    };
  },
  methods: {
    submitRole(roleForm) {
      updateRole(roleForm).then(res => {
        this.$message({
          message: '更新成功',
          type: 'success'
        });
        this.$router.go(-1)
      }).catch(err => {
        this.$message({
          message: err.message,
          type: 'error'
        });
      })
    }
  },
  mounted() {
    getRole(this.$route.params.id).then(res => {
      this.content = res.data
    }).catch(err => {
      this.$message({
        message: err.message,
        type: 'error'
      });
    })
  },
  components: { Table }
}
</script>

<style scoped >




 
</style>
